<template>
  <div class="Home">
    <div class="search">
      <van-search v-model="valueInp" placeholder="请输入搜索关键词" />
    </div>
    <div class="swiper"><swiperVue :SwiperList="SwiperList"></swiperVue></div>
    <div><ServiceVue :ServiceLsit="ServiceLsit"></ServiceVue></div>
  </div>
</template>
<script>
import swiperVue from "./components/Swiper.vue";
import ServiceVue from "./components/Service.vue";
import { getswiperlist, getservicelist } from "../../service/HomeService";

export default {
  components: { swiperVue, ServiceVue },
  data() {
    return {
      valueInp: "",
      SwiperList: "",
      ServiceLsit: "",
    };
  },
  methods: {
    async getSwiperList() {
      const { rows } = await getswiperlist({ type: 2 });
      this.SwiperList = rows;
    },
    async getServiceList() {
      const { rows } = await getservicelist({ type: 2 });
      this.ServiceLsit = rows
        .splice(0, 9)
        .concat([{ serviceName: "更多服务", id: 0 }]);
    },
  },
  created() {
    this.getSwiperList();
    this.getServiceList();
  },
};
</script>
